import request from '@/utils/request'

/**
 * 商品详情
 * @param {String} id  商品id
 * @returns {Promise} axios Promise
 */
export const findGoodsDetail = id => {
  return request('/goods', 'get', { id: id })
}

/**
 * 热销推荐
 * @param {Object} id  商品id
 * @param {Object} limit  数量限制
 * @param {Object} type  热销类型，1为24小时，2为周榜，3为总榜，默认为1
 * @returns {Promise} axios Promise
 */
export const findGoodsHot = ({ id, limit = 3, type = 1 }) => {
  return request('/goods/hot', 'get', { id, limit, type })
}

/**
 * 获取新的商品信息
 * @param {String} skuId - 商品SKUID
 * @returns Promise
 */
export const getNewCartGoods = skuId => {
  return request(`/goods/stock/${skuId}`, 'get')
}
